package com.hondee.busiPortal.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * 设置跨域访问webpage
 * @author Allen
 * @date 2014年11月3日
 */
public class CrossDomainFilter implements Filter {

	@Override
	public void destroy() {
		
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1,
			FilterChain arg2) throws IOException, ServletException {
		HttpServletResponse response=(HttpServletResponse)arg1;
		response.setHeader("Access-Control-Allow-Origin","http://172.16.0.48:10088");
		response.setHeader("Access-Control-Allow-Origin","https://plist2.gzpcc.cn");
//		response.setHeader("Access-Control-Allow-Origin","http://192.168.1.110:8087");
		response.addHeader("P3P","CP=\"IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA\"");
		arg2.doFilter(arg0, response);
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
	}

}
